﻿using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Caching;
using Volo.Abp.Modularity;

namespace Ecommerce.Application.Caching
{
    class EcomerceApplicationCachingModule
    {
        [DependsOn(typeof(AbpCachingModule))
    ]
    public class EcomerceApplicationCachingExtensions : AbpModule
    {
        public override void ConfigureServices(ServiceConfigurationContext context)
        {
            //从appsetting.json里取数据库连接
            var configuration = context.Services.GetConfiguration();
            var RedisConnectionString = configuration["Caching:RedisConnectionString"];
            //注册Redis服务
            context.Services.AddStackExchangeRedisCache(options =>
            {
                options.Configuration = RedisConnectionString;
            });
            }
        }
    }
}
